package com.hhf.riceshopping.cart.config;

import com.hhf.riceshopping.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class riceWebConfig implements WebMvcConfigurer {

    /**
     * 添加拦截器
     * @param registry 注册列表
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截当前购物车的所有请求
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
